<?php
/**
 * Copyright 2008 francissem (http://www.webmoss.net)(francissem@gmail.com)
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * 		http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * @author francissem
 * @copyright 2008 francissem (http://www.webmoss.net)(francissem@gmail.com)
 * @license http://www.apache.org/licenses/LICENSE-2.0
 */
abstract class Core_Controller_Response_Abstract extends ArrayObject{

	protected $content;
	protected $content_file;

	function __construct(){
		parent::__construct(array());
	}
	function setContent($content){
		$this->content=$content;
	}
	function setContentFile($file){
		$this->content_file = $file;
	}
	function setCilentCache(){
			
	}
	function setServerCache(){
			
	}
	function out(){
		if(is_file($this->content_file)){
			if(preg_match("/\.(jpg)$/i",basename($this->content_file))){
				$this["Content-Type"]="image/jpeg";
				foreach($this as $k=>$v) header("{$k}: {$v}");
				readfile($this->content_file);
			}elseif(preg_match("/(\.xml)?\.php$/i",basename($this->content_file))){
				$this["Content-Type"]="text/xml";
				foreach($this as $k=>$v) header("{$k}: {$v}");
				ob_start();
				include($this->content_file);
				$c = ob_get_contents();
				ob_end_clean();
				echo $c;
			}else{
					
					
			}
		}
	}
}
?>